import DB from "./myDB.js";

 function myDB({DBname , version = new Date().getTime(), tables =[]}){
   const db = new DB({
        DBname,
        version
    })

   for (const item of tables) {
      db.add_table(item)
   }

    return new Promise((resolve, reject) => {
        db.open({
            success:(res) =>{
               resolve(db)
            },
            error:(err) =>{
              reject(err)
            }
        })
    })

}
export default myDB
